package name.nano.client.dto;


import java.util.ArrayList;

import name.nano.client.utils.Coordinate;





import com.google.gwt.user.client.rpc.IsSerializable;




public class TeamTactic implements IsSerializable {
	private static final int ENDZONE_LENGHT = 23;
	private static final int FIELD_WIDTH = 34;
	public static final int FIELD_LENGHT = 110;
    
	private ArrayList<PlayerTactic> playersTactic;

	//private final Location fieldSize;

	private int baselineDefence;
	private int baselineOffence;

	private int playerWithDisk;
	
	
	private String m_tacticName;
	
	private Long key;
	
	public TeamTactic(){
		baselineDefence=(int) (getFieldSize().y*(ENDZONE_LENGHT/(double)FIELD_LENGHT));
		baselineOffence=(int) (getFieldSize().y*((FIELD_LENGHT-ENDZONE_LENGHT)/(double)FIELD_LENGHT));
	}
	
	public TeamTactic(String name,ArrayList<PlayerTactic> playersTactic) {
		this();
		this.m_tacticName=name;
		
		this.playersTactic = playersTactic;
	}
	public TeamTactic(TeamTactic source){
		this();
		ArrayList<PlayerTactic> pt=new ArrayList<PlayerTactic>();
		PlayerTactic[] dsPt = source.getPlayersTactic();
		for (int i = 0; i < dsPt.length; i++) {
			PlayerTactic playerTactic = dsPt[i];
			pt.add(new PlayerTactic(playerTactic));
		}
		setPlayerList(pt);
		this.m_tacticName=source.getTacticName();
		
	}
	public String getTacticName() {
		return m_tacticName;
	}

	public void setTacticName(String name) {
		m_tacticName = name;
	}

	public PlayerTactic[] getPlayersTactic() {
		return playersTactic.toArray(new PlayerTactic[playersTactic.size()]);
	}

	public Coordinate getFieldSize() {
		return new Coordinate(FIELD_WIDTH,FIELD_LENGHT);
	}

	public int getBaselineDefence() {
		return baselineDefence;
	}

	public int getBaselineOffence() {
		return baselineOffence;
	}

	public int getPlayerWithDisk() {
		return playerWithDisk;
	}

	public void setPlayerWithDisk(int playerWithDisk) {
		this.playerWithDisk = playerWithDisk;
	}

	public void setPlayerList(ArrayList<PlayerTactic> pt) {
		playersTactic=pt;
		
	}
	
	
}
